// 默认导出一个 focus 指令
export default {
  mounted(el) {
    el.focus()
  }
}

// 具名导出一个 copy 指令
//  v-copy="'张三'"
export const copy = {
  mounted(el, binding) {
    el.onclick = function () {
      const input = document.createElement('input')
      input.value = binding.value

      document.body.appendChild(input)
      input.select()
      document.execCommand('Copy')
      document.body.removeChild(input)
    }
  }
}
